User-Defined Max Function